﻿USE [ASPNETVN.PORTAL]
GO
/****** Object:  Table [dbo].[t_PhotoAlbum_Collections]    Script Date: 06/19/2008 15:42:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[t_PhotoAlbum_Collections](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ModuleID] [int] NOT NULL,
	[Title] [nvarchar](128) NOT NULL,
	[IsPrivate] [bit] NOT NULL CONSTRAINT [DF_t_PhotoAlbum_Collections_IsPrivate]  DEFAULT ((0)),
	[Description] [nvarchar](512) NULL,
	[CreatedBy] [nvarchar](128) NOT NULL,
	[CreationTime] [datetime] NOT NULL CONSTRAINT [DF_t_PhotoAlbum_Collections_CreationTime]  DEFAULT (getdate()),
 CONSTRAINT [PK_t_PhotoAlbum_Collections] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[t_PhotoAlbum_Pictures]    Script Date: 06/19/2008 15:42:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[t_PhotoAlbum_Pictures](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[CollectionID] [int] NOT NULL,
	[Title] [nvarchar](128) NULL,
	[FileName] [nvarchar](256) NOT NULL,
	[IsCover] [bit] NOT NULL CONSTRAINT [DF_t_PhotoAlbum_Pictures_IsCover]  DEFAULT ((0)),
 CONSTRAINT [PK_t_PhotoAlbum_Pictures] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[t_PhotoAlbum_Pictures]  WITH CHECK ADD  CONSTRAINT [FK_t_PhotoAlbum_Pictures_t_PhotoAlbum_Collections] FOREIGN KEY([CollectionID])
REFERENCES [dbo].[t_PhotoAlbum_Collections] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[t_PhotoAlbum_Pictures] CHECK CONSTRAINT [FK_t_PhotoAlbum_Pictures_t_PhotoAlbum_Collections]